 <link rel="stylesheet" type="text/css" href="css/validationEngine.jquery.css">
<link rel="stylesheet" type="text/css" href="css/template.css">

<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine.js"></script>
<script>
        jQuery(document).ready(function(){
            // binds form submission and fields to the validation engine
            jQuery("#formID").validationEngine();
        });
</script>
<script>
function Del_Info(str){
	var q=confirm('Bạn có chắc chắn muốn xóa hay không?');	
	if(q==true) 
		window.location=str;
	
}
</script>
<?php
			

			$sql="select max(MA_KIEU) from  qldl_kieu_tour"; 
			$result=mysql_query($sql); 
			$kq=mysql_fetch_array($result); 
			$ma=$kq[0]+1; 
				?>
<?php
$sql="SELECT substr( QUYEN,2,1 ) as mq
FROM qldl_tai_khoan
WHERE ten_dang_nhap = '".$_SESSION['username']."'";
	$query = @mysql_query($sql,$conn);
	$row = @mysql_fetch_array($query);
	if($row['mq']==1){
	 @header('Location: index.php?page=k_tour'); 
	}
	else {
	echo  "<script>alert ('Bạn không có quyền truy cập trang này!')</script>"; 
	echo "<meta http-equiv='refresh' content='0;url= index.php'>";
	}
?>
<div class="cpanel-right-tttk">
  <div id="panel-sliders" class="pane-sliders">
    <div class="panel">

<table width="100%" border="0" cellspacing="0" cellpadding="0" style=" padding:10px;">
  <thead>
        <tr style=" padding-bottom:10px;">
        <th colspan="3" align="left" style="padding-bottom:10px;">QUẢN LÍ KIỂU TOUR</th>
        </tr> 
        </thead> 
  <tr valign="top" style="padding:5px;">
    <td width="40%"><div style=" padding:0px; border-top: medium none; border-bottom: medium none; overflow: hidden; height: auto; width:100%" align="left">
         <form  name="formID" id="formID" action="" method="post"> 
      <table width="81%" height="113" border="1" bordercolor="#666666" class="adminlist_tt">
        <thead>
          <tr>
            <th colspan="3" align="center"> Thông tin thêm kiểu tour</th>
          </tr>
        </thead>
        <tbody>
        
        
          <tr>
            <td>Kiểu tour</td>
            <td >
              <input class="validate[required] text-input" type="text" name="txt_kieu_tour" id="txt_kieu_tour" />
            </td>
          </tr>
          <tr>
            <td  colspan="3">
              <input type="submit" name="btn_add_kt" id="btn_add_kt" value="Lưu" />
              <input type="reset" name="btn_huy" id="btn_huy" value="Hủy" onclick='window.location.href="index.php?page=k_tour"' />
              <?php 
					if(isset($_POST['btn_add_kt'])){
					$mkt = $_POST['txt_ma_kieu_tour'];
					$tkt = $_POST['txt_kieu_tour'];

					$sql = "INSERT INTO qldl_kieu_tour VALUES('$ma','$tkt')";
	  				$query = @mysql_query($sql,$conn);
						if($query)echo "<script>alert ('Thêm thông tin thành công.')</script>";	
						else echo "<script>alert ('Thêm không thành công!')</script>";
					}
					?>
            </td>
          </tr>

        </tbody>
      </table>
                </form>
    </div></td>
    <td width="50%"><div style=" padding:0px; border-top: medium none; border-bottom: medium none; overflow: hidden; height: auto; width:100%" align="left">
      <table width="100%" border="1" bordercolor="#666666" class="adminlist_tt">
        <thead>
          <tr>
            <th height="28" colspan="3" align="center"> Danh sách kiểu tours</th>
          	<?php include('kieu_tour/del.php'); ?>
          </tr>
        </thead>
        <tbody>
           <form action="" method="post" name="form_view" id="form_view">
          <tr> 
            <td width="105" align="center">Mã kiểu tour</td>
            <td width="337" align="center">Kiểu tour</td>
            <td width="66">Cập nhật</td>
          </tr>
          <?php  
	$stt=0;
	$sql="select * from qldl_kieu_tour order by MA_KIEU".@$_GET['sort'];
	$query = @mysql_query($sql,$conn);	
	if(!$query) echo "Query error to display.";
	else while($row = @mysql_fetch_array($query)){
		$stt++;
		?>
          <tr>
            <td><?php echo $row['MA_KIEU'];?></td>
            <td><?php echo $row['TEN'];?></td>
            <td><a href="index.php?page=id_edit_kt&amp;id_edit_kt=<?php echo $row['MA_KIEU'];?>">Sửa</a> 
            || <a onclick="Del_Info('index.php?page=k_tour&amp;id_del_kt=<?php echo $row['MA_KIEU']; ?>');" href="#">Xóa</a></td>
          </tr>
          <?php }?>
          </form>
        </tbody>
      </table>
    </div></td>
  </tr>
</table>

</div>
  </div>
</div>